if (!window["vg"]) {
    window["vg"] = {};
}

if (!vg.visualization) {
    vg.visualization = {};
}

vg.visualization.GanttChart = (function() {
    /**
     * Common functions used by all classes
     */

    var ActvityType = function(inputObj) {
        this.name = inputObj.name;
        this.colors = {
            "parent": {},
            "children": {}
        };
        try {
        	this["colors"]["parent"]["completed"] = inputObj["colors"]["parent"]["completed"]
        } catch {
        	this["colors"]["parent"]["completed"] = "#000000";
        }
		try {
			this["colors"]["parent"]["remaining"] = inputObj["colors"]["parent"]["remaining"]
		} catch {
			this["colors"]["parent"]["remaining"] = "#3366FE";
		}
		try {
			this["colors"]["children"]["completed"] = inputObj["colors"]["children"]["completed"]
		} catch {
			this["colors"]["children"]["completed"] = "#5F5F5F";
		}
		try {
			this["colors"]["children"]["remaining"] = inputObj["colors"]["children"]["remaining"]
		} catch {
			this["colors"]["children"]["remaining"] = "#99CCFE";
		}
        this.tooltip = inputObj.toolTip;
    }

    ActivityType.prototype = (function() {
    	var setName = function (newName) {
    		this.name = newName;
    		//code to change the name in the legend in the view
    	}

    	var setColor = function (forActivity, colors) {
    		if(colors) {
    			colors[forActivity]["completed"] && (this["colors"][forActivity]["completed"] = colors[forActivity]["completed"]);
    		}
    	}
    		
    })();
})();